<?php 
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('base');
class index extends base{
	public $db;
	function __construct() {
		parent::__construct();
		$this->db = pc_base::load_model('mentor_model');
	}
	
	public function init() {
		
	}
	
	/**
	 * 展示导师列表
	 */
	public function lists() {
		$html_title = "培训入口-导师介绍";
		$temp = "list";
		$mentorList = $this->mentorInfo();
		include template('mentor', $temp);
	}

	/**
	 * 导师详情
	 */
	public function show ()
	{
		//$id = $_GET['id']?(int)$_GET['id']:7;
		$id = 7;
		$mentor = $this->db->get_one(array('id'=>$id));
		var_dump($mentor);die;
	}

	/**
	 * 获取导师数据
	 */
	public function mentorInfo ()
	{
		$page = $_POST['page']?(int)$_POST['page']:1;
		$mentor = $this->db->listinfo('siteid = '.SITEID, 'id DESC', $page, 5);
		if ($page == 1) {
			return $mentor;
		} else {
			echo json_encode($mentor);die;
		}
	}
}
?>